package com.ruoyi.mapper;

import com.ruoyi.domain.HisCart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface HisMedicineCartMapper {
   //添加用户购物车
   @Insert("insert into his_medicine_cart values(default,#{userId},#{cart},#{remark})")
   int   addDrugToCart(HisCart hisCart);

   //根据用户id查询购物车数据
   @Select("select * from his_medicine_cart where user_id = #{userId}")
   HisCart selectCartByUserId(Long userId);


   //修改对应用户对应商品id的购物车商品信息  这里是更新cart字段
   @Update("update his_medicine_cart set cart = #{cart} where user_id = #{userId}")
   int updateCart(HisCart cart);

}
